﻿# coding: utf-8

import wx
import wx.lib.colourselect as csel
import wx.lib.agw.cubecolourdialog as CCD

class wxColorPickButton(csel.ColourSelect):
    def OnClick(self, event):
        colourData = wx.ColourData()    
        colourData.SetColour(self.GetColour())        
        dlg = CCD.CubeColourDialog(self, colourData)
        changed = dlg.ShowModal() == wx.ID_OK

        if changed:
            data = dlg.GetColourData()
            self.SetColour(data.GetColour())
            self.SetBackgroundColour(data.GetColour())
            self.OnChange()

        dlg.Destroy()
